<%--                                                                       --%>
<%-- Copyright (c) 2001-2004 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries.                       --%>
<%--                                                                       --%>

<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/bv-html.tld" prefix="bvhtml" %>

<script language="javascript" src="<%= request.getContextPath() %>/cs/js/date.js" type="text/javascript">
</script>

<script language="javascript">

function isValAllDigits(argvalue) {
  argvalue = argvalue.toString();
  var validChars = "0123456789";
  var startFrom = 0;
  for (var n = startFrom; n < argvalue.length; n++) {
    if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
  }
  return true;
}

function isAllZeros(argvalue) {
  argvalue = argvalue.toString();
  var validChars = "0";
  var startFrom = 0;
  for (var n = startFrom; n < argvalue.length; n++) {
    if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
  }
  return true;
}

function onClickSearch(theForm) {
  value=theForm.maxReturn.value;
  if (value.length < 0) {
    alert('<bean:message bundle="appCommonRes" key="bp.error.mycs.search.maxReturns"/>');
    return false;
  }
  if (!isValAllDigits(value) || isAllZeros(value)) {
    alert('<bean:message bundle="appCommonRes" key="bp.error.mycs.search.maxReturns"/>');
    return false;
  }
  return true;
}
</script>

<html:form action="/myCSSearch.do">
  <input type="hidden" name="doSearch" value="true">

  <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="My collaboration space search criteria">
    <tr>
      <td class="label" width="20%" nowrap><bean:message bundle="appCommonRes" key="bp.mycs.search.name"/>:</td>
	  <td class="labelField" width="80%">
	    <html:text property="csNameCriteria" size="31" maxlength="80" />
	  </td>
    </tr>
    <tr>
      <td class="label" width="20%" nowrap><bean:message bundle="appCommonRes" key="bp.mycs.status"/>:</td>
	  <td class="labelField" width="80%">
  	    <html:radio property="statusCriteria" value="0" />
 	    <bean:message bundle="appCommonRes" key="bp.mycs.status.all" />
	    <html:radio property="statusCriteria" value="1" />
	    <bean:message bundle="appCommonRes" key="cs.status.active" />
	    <html:radio property="statusCriteria" value="2" />
	    <bean:message bundle="appCommonRes" key="cs.status.completed" />	    
	  </td>
    </tr>
    <tr>
      <td class="label" width="20%" nowrap><bean:message bundle="appCommonRes" key="bp.mycs.max.return"/>:</td>
	  <td class="labelField" width="80%">
	    <html:text property="maxReturn" size="5" maxlength="80" />
	  </td>
    </tr>
    <tr>
      <td class="label" width="20%"><bean:message bundle="appCommonRes" key="bp.mycs.created.between"/>:</td>
      <td class="labelField" width="80%" nowrap>
        <bvhtml:date property="creationDateStart"/>
        <a href="JavaScript:datePopup('<html:rewrite   page="/cs/calendar.do"/>',
                            'myCSSearchForm','creationDateStart')">
          <img src="<%= request.getContextPath() %>/ca/images/icons/calendar.gif" 
      		     width="23" height="22" border="0" align="absmiddle" alt="<bean:message key="cs.image.alt.calendar"/>" title="<bean:message key="cs.image.alt.calendar"/>"/></a>
        <html:hidden property="creationDateStart.hour" value="0"/>
        <html:hidden property="creationDateStart.minute" value="0"/>
        <html:hidden property="creationDateStart.ind" value="0"/>

        <br>
        <bean:message bundle="appCommonRes" key="bp.processInstance.search.and" />
        <br>
        <bvhtml:date property="creationDateEnd"/>
      	<a href="JavaScript:datePopup('<html:rewrite   page="/cs/calendar.do"/>', 
      	                   'myCSSearchForm','creationDateEnd')">
      	  <img src="<%= request.getContextPath() %>/ca/images/icons/calendar.gif" 
      		     width="23" height="22" border="0" align="absmiddle" alt="<bean:message key="cs.image.alt.calendar"/>" title="<bean:message key="cs.image.alt.calendar"/>"/></a>
        <html:hidden property="creationDateEnd.hour" value="23"/>
        <html:hidden property="creationDateEnd.minute" value="59"/>
        <html:hidden property="creationDateEnd.ind" value="59"/>
	  </td>
    </tr>
    <tr>
      <td class="label" width="20%" nowrap><bean:message bundle="appCommonRes" key="bp.mycs.order.by"/>:</td>
	  <td class="labelField" width="80%">
	    <html:select property="sortBy">
	      <html:option value="creationTime" key="bp.mycs.creationdate" bundle="appCommonRes" />
   	      <html:option value="name" key="bp.mycs.search.name" bundle="appCommonRes" />
	    </html:select>
	    <html:select property="ascending">
	      <html:option value="true" key="bp.mycs.order.ascending" bundle="appCommonRes" />
	      <html:option value="false" key="bp.mycs.order.descending" bundle="appCommonRes" />
	    </html:select>
	  </td>
    </tr>
  </table>
	<div class="pageButtonWrap" align="right"> 
        <html:reset property="resetBtn" styleClass="pageButton">
          <bean:message bundle="appCommonRes" key="button.reset" />
        </html:reset>
        <html:submit property="submitBtn" styleClass="pageButton" onclick="return onClickSearch(this.form)">
          <bean:message bundle="appCommonRes" key="bp.mycs.search" />
        </html:submit>
  </div>
</html:form>
<!-- End Search my collaboration space block -->
